<?php
	class SecurityManager extends Base {
		
		public static function login($login, $password) {
			Logger::debug("SecurityManager", "Armazenando informacoes de usuario na sessao : '$login'");
			$user = array("login"=>$login, "password"=>$password, "date"=> date("F j, Y, g:i a"));
			Scope::putSessionVar(Constants::USER_SESSION, $user);
		}
		
		public static function getUser() {
			Logger::debug("SecurityManager", "Recuperando informacoes do usuario em sessao");
			return Scope::loadSessionObject(Constants::USER_SESSION);
		}
		
		public static function logout() {
			Logger::debug("SecurityManager", "Efetuando o logout");
			@session_start();
			@session_destroy();
		}
		
		public static function isAllowedAccess() {
			Logger::debug("SecurityManager", "Verificando se existe usuario logado");
			return Scope::loadSessionObject(self::$USER_SESSION_KEY) != null;			
		}
	}
?>